/**
 * Created by ebi on 2017/5/11.
 */
import Vue from 'vue'
import ElementUI from 'element-ui'

import router from './router'
import store from './store'
import api from './api'
import App from './App.vue'
import encrypt from './util/encrypt'
import './mock'

import 'element-ui/lib/theme-chalk/index.css'
import 'font-awesome/css/font-awesome.min.css'

import './assets/style/main.css'

Vue.use(ElementUI)
Vue.prototype.$api = api
Vue.prototype.$encrypt = encrypt

if (!store.state.token) {
  const token = window.sessionStorage.getItem('token') || ''
  store.commit('setToken', token)
  const publicKey = window.sessionStorage.getItem('publicKey') || ''
  store.commit('setPublicKey', publicKey)
}

/* 下面这句注释不能删，不然通不过eslint */
/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
})
